﻿@using System.Globalization
@using CkSoftware.GroupMe.Sdk.TestWeb.Helpers
@using CkSoftware.GroupMe.Sdk.TestWeb.Models
@model AuthCallbackModel
@{
    ViewBag.Title = "Client authentication callback";
}

<div class="page-header">
    <h1>Client authentication callback</h1>
</div>

@if (!string.IsNullOrEmpty(Model.AccessToken))
{
	<div class="alert alert-block alert-success">
		<h4>Authentication successful</h4>
		<p>This authentication was successful and we got the following access-token: <strong>@Model.AccessToken</strong></p>
	</div>

	<h5>Authenticated user data</h5>
	<table class="table table-condensed table-striped">
		<tr>
			<th>UserId</th>
			<td>@Model.CurrentUser.UserId</td>
		</tr>
		<tr>
			<th>Phone number</th>
			<td>@Model.CurrentUser.PhoneNumber</td>
		</tr>
		<tr>
			<th>Avatar image</th>
			<td>@Html.AvatarImageForGroupMePicture(Model.CurrentUser.AvatarImage, Model.CurrentUser.Name)</td>
		</tr>
		<tr>
			<th>User name</th>
			<td>@Model.CurrentUser.Name</td>
		</tr>
		<tr>
			<th>Created at</th>
			<td>@Model.CurrentUser.CreatedAt.ToString(CultureInfo.CurrentCulture)</td>
		</tr>
		<tr>
			<th>Updated at</th>
			<td>@Model.CurrentUser.UpdatedAt.ToString(CultureInfo.CurrentCulture)</td>
		</tr>
		<tr>
			<th>Email</th>
			<td>@Model.CurrentUser.Email</td>
		</tr>
		<tr>
			<th>SMS Mode enabled</th>
			<td>@Html.Bootstrap().Icon(Model.CurrentUser.SmsModeEnabled ? Icons.ok : Icons.remove)</td>
		</tr>
	</table>
}
else
{
    <div class="alert alert-block alert-error">
        <h4>Authentication failed</h4>
        <p>For some reason there was no authentication token in the request query-string. Perhaps you directly clicked on the sub-menu item on the left?</p>
    </div>
}
